<layout name="Iflayout"/>
<script src="/public/js/jquery.js"></script>
<div class="xyh-content">

    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><em class="glyphicon glyphicon-cloud-upload"></em>
                节点列表
            </h3>
        </div>

    </div>

    <div class="row margin-botton">
        <div class="col-sm-6 column">
            <div class="btn-group btn-group-md">
                <button class="btn btn-primary" type="button" onclick="goUrl('/xyhai.php?s=/Rbac/addNode/level/1')"><em class="glyphicon glyphicon-plus-sign"></em> 添加应用(节点)</button>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="alert alert-warning" role="alert">
                <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
                <span class="sr-only">Note:</span>
                节点：应用(level:1)->控制器(level:2)->方法(level:3)
            </div>
        </div>
    </div>
    <foreach name="arr" item="v">
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-info">
                <div class="panel-heading">
                    <div class="row">
                        <div class="col-xs-8">
                            <h3 class="panel-title">{$v.title}</h3>
                        </div>
                        <div class="col-xs-4 text-right">
                            <a href="{:U('Node/add')}?level={$v.level}&id={$v.id}" class="btn btn-xs btn-primary" title="添加"><i class="glyphicon glyphicon-plus-sign"></i> </a>
                            <a href="{:U('Node/upd')}?id={$v.id}&level={$v.level}" class="btn btn-xs btn-success" title="修改"><i class="glyphicon glyphicon-edit"></i></a>
                        </div>
                    </div><!--分组-->
                </div>
                <foreach name="v['son']" item="vv">
                <div class="panel-body xyh-panel-body">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <div class="row">
                                <div class="col-xs-8">
                                    <h3 class="panel-title">{$vv.title}</h3>
                                </div>
                                <div class="col-xs-4 text-right">
                                    <a href="javascript:void(0)" id="del5"   class="label label-danger"><i class="glyphicon glyphicon-remove" m="{$vv.id}"></i></a>&nbsp;
                                    <a href="{:U('Node/add')}?level={$vv.level}&id={$vv.id}" class="btn btn-xs btn-primary" title="添加"><i class="glyphicon glyphicon-plus-sign"></i> </a>
                                    <a href="{:U('Node/upd')}?id={$vv.id}&level={$vv.level}" class="btn btn-xs btn-success" title="修改"><i class="glyphicon glyphicon-edit"></i></a>
                                </div>
                            </div>
                        </div><!--二级权限-->
                        <foreach name="vv['son']" item="vvv">
                            <div style="float: left;" class="col-md-3 column">
                                <span class="label label-primary">{$vvv.title}</span>

                                <a href="{:U('Node/upd')}?id={$vvv.id}&level={$vvv.level}" class="label label-success"><i class="glyphicon glyphicon-edit"></i></a>
                                <a href="javascript:void(0)" id="del3"   class="label label-danger"><i class="glyphicon glyphicon-remove" m="{$vvv.id}"></i></a>&nbsp;
                            </div>
                    <!--三级权限-->
                            </foreach>
                </div>
            </div>
                  </foreach>
            </div>
            <div class="panel panel-info">

            <div class="panel-body xyh-panel-body">
            </div>
        </div>
        </div>
    </div>
   </foreach>
    <script>
        $(function(){
            $('.glyphicon-remove').click(function(){
                if(confirm('确定删除?')){
                    var _id = $(this).attr('m');
                    var _this = $(this);
                    $.post("{:U('Node/del')}", {id:_id}, function(data){
                        if(data){
                            alert('删除成功');
                            _this.parent().parent().remove();
                        }else{
                            alert('删除失败');
                        }
                    })
                }
            })
        })
    </script>